<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<meta name="renderer" content="webkit|ie-comp|ie-stand">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport"
	content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,member-scalable=no" />
<meta http-equiv="Cache-Control" content="no-siteapp" />
<!--[if lt IE 9]>
<script type="text/javascript" src="lib/html5.js"></script>
<script type="text/javascript" src="lib/respond.min.js"></script>
<script type="text/javascript" src="lib/PIE_IE678.js"></script>
<![endif]-->
<link href="css/H-ui.min.css" rel="stylesheet" type="text/css" />
<link href="css/H-ui.admin.css" rel="stylesheet" type="text/css" />
<link href="lib/Hui-iconfont/1.0.1/iconfont.css" rel="stylesheet"
	type="text/css" />
<!--[if IE 6]>
<script type="text/javascript" src="http://lib.h-ui.net/DD_belatedPNG_0.0.8a-min.js" ></script>
<script>DD_belatedPNG.fix('*');</script>
<![endif]-->
<title>促销活动商品管理</title>
</head>
<body>
	<nav class="breadcrumb">
		<i class="Hui-iconfont">&#xe67f;</i> 首页 <span class="c-gray en">&gt;</span> 营销中心 <span class="c-gray en">&gt;</span> 一元购管理 

		<a class="btn btn-success btn-refresh radius r mr-20"
			style="line-height:1.6em;margin-top:3px" onclick="javascript:location.replace(location.href);"
			href="javascript:location.replace(location.href);" title="刷新">刷新</a>

		<a class="btn btn-primary radius r mr-10 mt-5" onclick="t_goods_activity_add('添加一元购','<%=path%>/backstage/t_goods_activity_yiyuan-add-pre')" href="javascript:;"> 添加一元购</a>

	</nav>
	<div class="pd-20">
	    <div class="cl pd-5 bg-1 bk-gray"> 
		<form action="<%=path%>/backstage/t_goods_activity-list" method="get" class="form form-horizontal" id="form-goods-add" onsubmit="beforSubmit()">
			<div class="text-c"> 
				<div class="row cl">
					<label class="form-label col-1">所属县市：</label>
					<div class="formControls col-2"> 
						<span class="select-box">
							<select class="select" name="cityid" id="">
								<c:forEach items="${citys}" var="city">
									<option value="${city.id}" <c:if test="${city.id==goods.city_id}">selected</c:if> >${city.name}</option>
								</c:forEach>
							</select>
						</span>
		   			</div>
		   			<input type="hidden" name="act" value="${act }">
				<button name="" id="" class="btn btn-success f-r radius mr-20" type="submit"><i class="Hui-iconfont">&#xe665;</i> 查询</button>
				</div>
				<div class="mt-10"></div>
			</div>
		</form>
		</div>

		<div class="mt-20">
			<table
				class="table table-border table-bordered table-hover table-bg table-sort">
				<thead>
					<tr class="text-c">
                       <!--  <th width="80">编号</th> -->
						<!--
                        <th width="80">活动的名称</th>
                        <th width="80">活动的描述</th>
						-->
						<!-- <th>图片</th> -->
                        <th width="80">分类</th>
                        <th width="80">所属县市</th>
                       <!--  <th>商品编号</th>
                        <th width="80">货品编号</th>
                        <th width="80">商品名称</th> -->
                        <th >开始时间</th>
                        <th >结束时间</th>
                        <th >活动状态</th>
			
						<th width="100">操作</th>
					</tr>
				</thead>
				<tbody>
						<c:forEach items="${t_goods_activitys}" var="tga">
						
						<tr class="text-c">
							<%-- <input type="hidden" id="id" name="id"
								value='${t_goods_activity.act_id}' /> --%>
    
                            <%-- <td>${t_goods_activity.act_id}</td> --%>
							<%-- <td><img src="<%=path%>${tga.act_img}" height="30" border="0" /></td> --%>
							<td>
							<c:forEach items="${types}" var="type">
								<c:if test="${type.cCode==tga.act_type_id}">
									${type.cName}
								</c:if>
							</c:forEach>
							</td>

                            <td>
							<c:forEach items="${citys}" var="city">
								<c:if test="${city.id==tga.city_id}">
									${city.name}
								</c:if>
							</c:forEach>
							</td>
                            <%-- <td>${t_goods_activity.goods_id}</td>
                            <td>${t_goods_activity.product_id}</td>
                            <td>${t_goods_activity.goods_name}</td> --%>
                            <td>${tga.start_time}</td>
                            <td>${tga.end_time}</td>
                            <td>
								<c:if test="${tga.is_finished==1 }">未开始</c:if>
								<c:if test="${tga.is_finished==2 }">已结束</c:if>
								<c:if test="${tga.is_finished==3 }">进行中</c:if>
							</td>
                            <%-- <td>${tga.is_finished}</td> --%>

							<td class="td-manage">
							<a style="text-decoration:none"
								onClick="t_goods_activity_edit('${tga.act_type_id}','${tga.city_id }','${tga.start_time }','${tga.end_time }')" href="javascript:void(0);"
								title="编辑">编辑</a>
								<%-- &nbsp;&nbsp;&nbsp;&nbsp;
								<a style="text-decoration:none"
								onClick="t_goods_activity_delete(this,'${tga.act_id}')" href="javascript:void(0);"
								title="删除">删除</a> --%>
							</td>
						</tr>
					</c:forEach>
				</tbody>
			</table>
		</div>
	</div>
	<script type="text/javascript" src="lib/jquery/1.9.1/jquery.min.js"></script>
	<script type="text/javascript" src="lib/layer/1.9.3/layer.js"></script>
	<script type="text/javascript" src="lib/laypage/1.2/laypage.js"></script>
	<script type="text/javascript" src="lib/My97DatePicker/WdatePicker.js"></script>
	<script type="text/javascript"
		src="lib/datatables/1.10.0/jquery.dataTables.min.js"></script>
	<script type="text/javascript" src="js/H-ui.js"></script>
	<script type="text/javascript" src="js/H-ui.admin.js"></script>
	<script type="text/javascript">
		$(function() {
			$('.table-sort').dataTable({
				"aaSorting" : [ [ 2, "asc" ] ],//默认第几个排序
				"bStateSave" : true,//状态保存
				"aoColumnDefs" : [
				//{"bVisible": false, "aTargets": [ 3 ]} //控制列的隐藏显示
				{
					"orderable" : false,
					"aTargets" : [ 0, 1, 4, 5 ]
				} // 制定列不参与排序
				]
			});
			$('.table-sort tbody').on('click', 'tr', function() {
				if ($(this).hasClass('selected')) {
					$(this).removeClass('selected');
				} else {
					table.$('tr.selected').removeClass('selected');
					$(this).addClass('selected');
				}
			});
		});

		/*添加*/
		function t_goods_activity_add(title, url) {
			var index = layer.open({
				type: 2,
				title: title,
				content: url
			});
			layer.full(index);
		}

		/*编辑*/
		function t_goods_activity_edit(tid,cid,stime,etime){
			var str="typeid="+tid+"&cityid="+cid+"&stime="+stime+"&etime="+etime;
			var edit_page = "<%=path%>/backstage/t_goods_activity_yiyuan-add-pre?"+str;
			var index = layer.open({
				type: 2,
				title: "编辑一元购",
				content: edit_page
			});
			layer.full(index);
		}

		/*删除*/
		function t_goods_activity_delete(obj,id){
			layer.confirm('确认删除？', {
				btn: ['确认','取消'], 
				shade: false
			},
			function(){
				$.ajax({
					type : "POST",
					url : "<%=path%>/backstage/t_goods_activity-delete",
					data : "id=" + id,
					error : function() {
						layer.msg('操作失败', {icon:5,time:1000});
					},
					success : function(msg) {
						layer.msg('已删除 ' + msg.information, {icon:6,time:1000});
						$(obj).parents("body").find(".btn-refresh").click();
					}
				});
			},
			function(){
				layer.msg('未删除', {icon:5,time:1000});
			});	
		}
	</script>
</body>
</html>



